﻿Imports OMANE.Common.UI
Imports System.Windows.Input

Namespace ViewModels
    Public Class ViewModelEstimateurs
        Inherits ViewModelCommand
        Implements IViewModelTabSection

        Private _model As ModelTauxGarantis
        Public Property IsClosable As Boolean Implements IViewModelTabSection.IsClosable


        Public Sub New(ByVal Model As ModelTauxGarantis, ByVal DisplayName As String, ByVal Command As ICommand)
            MyBase.New(DisplayName, Command)
            _model = Model
            ViewModels.SegmentProvider.model = Model

            _DureeEnNombreDeMois = New SegmentableValue(Of Double)( _
                AddressOf SegmentCommandNotification, _
               _model.ListeParametres.Duree_Actu.Nom, _
               "Durée en nombre  de mois", True)

            _TauxNominal = New SegmentableValue(Of Double)( _
                AddressOf SegmentCommandNotification, _
               _model.ListeParametres.TxNom_Actu.Nom, _
               "Taux  nominal", True)

            _TauxDeMortalite = New SegmentableValue(Of Double)( _
                AddressOf SegmentCommandNotification, _
               _model.ListeParametres.TxMort_Actu.Nom, _
               "Taux de mortalités", True)

            _TauxCommissionSegmente = New SegmentableValue(Of Double)( _
                AddressOf SegmentCommandNotification, _
               _model.ListeParametres.Tx_CommiContA.Nom, _
               "Taux de commission", True)

            Title = "ESTIMATEURS"
        End Sub

        Public Property Icone As String Implements Common.UI.IViewModelTabSection.Icone
        Public Property Title As String Implements Common.UI.IViewModelTabSection.Title


        Sub New()
        End Sub

        Private _DureeEnNombreDeMois As SegmentableValue(Of Double) 
        Public Property DureeEnNombreDeMois As SegmentableValue(Of Double)
            Get
                Return _DureeEnNombreDeMois
            End Get
            Set(ByVal value As SegmentableValue(Of Double))
                OnPropertyChanging("DureeEnNombreDeMois")
                _DureeEnNombreDeMois = value
                OnPropertyChanged("DureeEnNombreDeMois")
            End Set
        End Property

        Private _TauxNominal As SegmentableValue(Of Double) 
        Public Property TauxNominal As SegmentableValue(Of Double)
            Get
                Return _TauxNominal
            End Get
            Set(ByVal value As SegmentableValue(Of Double))
                OnPropertyChanging("TauxNominal")
                _TauxNominal = value
                OnPropertyChanged("TauxNominal")
            End Set
        End Property

        Private _TauxDeMortalite As SegmentableValue(Of Double) 
        Public Property TauxDeMortalite As SegmentableValue(Of Double)
            Get
                Return _TauxDeMortalite
            End Get
            Set(ByVal value As SegmentableValue(Of Double))
                OnPropertyChanging("TauxDeMortalite")
                _TauxDeMortalite = value
                OnPropertyChanged("TauxDeMortalite")
            End Set
        End Property

        Private _TauxCommissionSegmente As SegmentableValue(Of Double)
        Public Property TauxCommissionSegmente As SegmentableValue(Of Double)
            Get
                Return _TauxCommissionSegmente
            End Get
            Set(ByVal value As SegmentableValue(Of Double))
                OnPropertyChanging("TauxDeMortalite")
                _TauxCommissionSegmente = value
                OnPropertyChanged("TauxDeMortalite")
            End Set
        End Property

        Private _NombreInitialAssures As SegmentableValue(Of Double) 
        Public Property NombreInitialAssures As SegmentableValue(Of Double)
            Get
                Return _NombreInitialAssures
            End Get
            Set(ByVal value As SegmentableValue(Of Double))
                OnPropertyChanging("NombreInitialAssures")
                _NombreInitialAssures = value
                OnPropertyChanged("NombreInitialAssures")
            End Set
        End Property

        Private _CapitalInitialMoyen As SegmentableValue(Of Double)
        Public Property CapitalInitialMoyen As SegmentableValue(Of Double)
            Get
                Return _CapitalInitialMoyen
            End Get
            Set(ByVal value As SegmentableValue(Of Double))
                OnPropertyChanging("CapitalInitialMoyen")
                _CapitalInitialMoyen = value
                OnPropertyChanged("CapitalInitialMoyen")
            End Set
        End Property

#Region "Segment"
        

        Private _CurrentSegmentableValue As Object
        Public Property CurrentSegmentableValue As Object
            Get
                Return _CurrentSegmentableValue
            End Get
            Set(ByVal value As Object)
                OnPropertyChanging("CurrentSegmentableValue")
                _CurrentSegmentableValue = value
                OnPropertyChanged("CurrentSegmentableValue")
            End Set
        End Property

        Private Sub SegmentCommandNotification(ByVal sender As Object, ByVal param As Object)
            CurrentSegmentableValue = sender
        End Sub
#End Region

    End Class
End Namespace
